<%Const respagecode="permissions_home"%><% 'UTF-8%>
<%''加载通用函数和数据库连接%>
<!--#include file="../Include/Start.asp"-->
<%  

UserName=ReplaceBadChar(Trim(request.Form("UserName"))) 
UserPassword=ReplaceBadChar(Trim(request.Form("UserPassword"))) 
'UserName="fashioncat"
'UserPassword="fashioncat"

UserPassword = MD5(UserPassword, 16)
Dim isUser
 isUser = False
    If (UserName = "" Or UserPassword = "" ) Then
        ReDim UserSetting(50)
        isUser = False
    End If
    
 
  Dim rsObj,strSql,TrueName
  set rsObj=Server.CreateObject("ADODB.Recordset")
  strSql = "SELECT * FROM PE_User "   & "WHERE UserName='" & UserName & "' AND UserPassword='" & UserPassword & "'  "   
 
    
  Set rsObj = Conn.Execute(strSql)
    If rsObj.BOF And rsObj.EOF Then
        ReDim UserSetting(50)
        isUser = False
    Else
        isUser = True
        UserID = rsObj("UserID")
        UserName = rsObj("UserName")
        TrueName = rsObj("TrueName")
        'LoginTimes = rsObj("LoginTimes")
    End If
    rsObj.close 
    Set rsObj = Nothing
 

'定义json对象
Dim loginObj
Set loginObj = jsObject()

	Session("UserName")="" 
	Session("UserID")=""
	

if isUser = False then 
	loginObj("msg") = "登陆失败，请确定用户名和密码！"
	loginObj("success") = "false"
	loginObj("url") = "login.asp"
else 
	Session("TrueName")=TrueName 
	Session("UserName")=UserName 
	Session("UserID")=UserID
	loginObj("msg") = "登录成功,跳转中..."
	loginObj("success") = "true"
	loginObj("url") = "../console"
end if 
'输出json对象
loginObj.Flush
''Response.Write strSql

call CloseConn
 
%>
